<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="${pageContext.request.contextPath}/static/semantic/semantic.min.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/blog.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.4.1.js"></script>
    <script src="${pageContext.request.contextPath}/static/semantic/semantic.min.js"></script>
</head>
<body>
<nav class="ui  attached segment b-padding-tb-tiny">
    <div class="ui container">
        <div class="ui secondary stackable menu">
            <a href="${pageContext.request.contextPath}/manage/manage" class="m-item item m-mobile-hidden"><h3 class="ui teal item header">小黑blog</h3></a>
            <a href="${pageContext.request.contextPath}/" class="m-item item m-mobile-hidden"><i class="bookmark outline icon"></i>首页</a>
            <a id="akind" href="${pageContext.request.contextPath}/kind/1/1" class="m-item item m-mobile-hidden"><i class="idea outline icon"></i> 分类</a>
            <a id="alabel" href="${pageContext.request.contextPath}/label/1/1" class="m-item item m-mobile-hidden"><i class="bookmark outline icon"></i> 标签</a>
            <a href="#" class="m-item item m-mobile-hidden"><i class="bookmark outline icon"></i> 归档</a>
            <a href="${pageContext.request.contextPath}/toAbout" class="m-item item m-mobile-hidden"><i class="user outline icon"></i> 关于我</a>
            <div class="ui input  stackable item right m-item m-mobile-hidden">
                <input type="text" name="" placeholder="search..">
                <button class="ui basic  button"><i class="search icon"></i>搜索</button>
            </div>
            <div class="ui item stackable right">
                <c:if test="${sessionScope.user==null}">
                    <a href="${pageContext.request.contextPath}/toLogin" class="item right  m-mobile-hidden m-item">登录</a>
                </c:if>
                <c:if test="${sessionScope.user!=null}">
                    <label>${sessionScope.user.username}&nbsp;&nbsp;|&nbsp;&nbsp; </label><a href="${pageContext.request.contextPath}/logout">退出登录</a>
                </c:if>
            </div>
        </div>
    </div>
    <a href="#" id="headshow" class="ui icon button b-top-right m-mobile-show">
        <i class="sidebar icon"></i>
    </a>

</nav>

<script>
    $("#headshow").click(function () {
        $(".m-item").toggleClass("m-mobile-hidden");
    });

    $(function () {
        $.ajax({
            url:"${pageContext.request.contextPath}/firstid",
            method:"get",
            success:function (response) {
                console.log(response);
                $kind=response.objectMap.kind;
                $label=response.objectMap.label;
                $("#akind").attr("href","${pageContext.request.contextPath}/kind/"+$kind+"/1");
                $("#alabel").attr("href","${pageContext.request.contextPath}/label/"+$label+"/1");

            }
            }
        )
    });


</script>
</body>
</html>